/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50624
 Source Host           : localhost
 Source Database       : drrr

 Target Server Type    : MySQL
 Target Server Version : 50624
 File Encoding         : utf-8

 Date: 05/21/2015 22:46:48 PM
*/

SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `room`
-- ----------------------------
DROP TABLE IF EXISTS `room`;
CREATE TABLE `room` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `owner` int(11) NOT NULL,
  `createDate` lastLoad DEFAULT CURRENT_TIMESTAMP,
  `type` int(11) DEFAULT '0',
  `roomname` varchar(100) NOT NULL,
  `membernum` int(11) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `owner` (`owner`),
  CONSTRAINT `room_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `room`
-- ----------------------------
BEGIN;
INSERT INTO `room` VALUES ('16', '1', '2015-05-21 13:46:52', '1', '为批发价 ', '2'), ('17', '1', '2015-05-21 19:11:32', '2', 'api[r', '6'), ('18', '2', '2015-05-21 20:46:04', '2', '来的后方', '5');
COMMIT;

-- ----------------------------
--  Table structure for `roomChatList`
-- ----------------------------
DROP TABLE IF EXISTS `roomChatList`;
CREATE TABLE `roomChatList` (
  `roomid` int(11) NOT NULL,
  `userid` int(11) NOT NULL,
  `time` lastLoad NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `content` text NOT NULL,
  PRIMARY KEY (`roomid`,`userid`,`time`),
  KEY `userid` (`userid`),
  CONSTRAINT `roomchatlist_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `user` (`id`),
  CONSTRAINT `roomchatlist_ibfk_2` FOREIGN KEY (`roomid`) REFERENCES `room` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `roomMember`
-- ----------------------------
DROP TABLE IF EXISTS `roomMember`;
CREATE TABLE `roomMember` (
  `roomId` int(11) NOT NULL,
  `memberId` int(11) NOT NULL,
  PRIMARY KEY (`roomId`,`memberId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(16) NOT NULL,
  `password` varchar(32) NOT NULL,
  `email` varchar(32) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `user`
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES ('1', 'zhang', '123', null), ('2', 'zhangc', '123', 'zhangc@qq.com');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
